import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { FileUploadModule } from 'ng2-file-upload';
import { Http, XSRFStrategy, XHRBackend, RequestOptions } from '@angular/http';
import { Router } from '@angular/router';
import { CustomFormsModule } from 'ng2-validation';
import { FormsModule } from '@angular/forms';

import { CommonService } from '../../core/common/common.service';
import { CloudSharedModule } from '../../shared/shared.module';
import { httpFactory } from '../../core/http/http.factory';
import { DefaultRequestOptions, requestOptionsProvider } from '../../core/http/default-request-options.service';
import { LocalXSRFStrategy } from '../../core/http/local-xsrf-strategy.service';
import { ConfigService } from '../../core/common/config.service';
import { TableDictService } from '../../core/common/table-dict.service';
import { Code2NameService } from '../../core/common/code-name.service';
import { AddChannel } from './add/addChannel';
import { ChannelManage } from './manage/channelManage';
import { Quato } from './quato/quato';
import { ChannelService } from './service/channel.service';
import { UsermanageComponent } from './usermanage/usermanage.component';

const routes: Routes = [
  { path: '', redirectTo: 'channel' },
  { path: 'chnlManage', component: ChannelManage },
  { path: 'addChannel', component: AddChannel },
  { path: 'editChannel', component: AddChannel },
  { path: 'quato', component: Quato },
  { path: 'userManage', component: UsermanageComponent },
];
@NgModule({
  imports: [
    CloudSharedModule,
    FileUploadModule,
    CustomFormsModule,
    FormsModule,
    RouterModule.forChild(routes)
  ],
  declarations: [
    ChannelManage, AddChannel, Quato, UsermanageComponent
  ],
  exports: [
    RouterModule,
  ],
  providers: [Code2NameService, ChannelService, CommonService, ConfigService, requestOptionsProvider, TableDictService,
    DefaultRequestOptions,
    {
      provide: XSRFStrategy, useClass: LocalXSRFStrategy,
    },
    {
      provide: Http,
      useFactory: httpFactory,
      deps: [XHRBackend, RequestOptions, ConfigService, Router]
    }]
})
export class ChannelModule { }
